/*
package com.wyiot;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.wyiot.pet.StartApplication;
import com.wyiot.core.enums.PetTypeEnum;
import com.wyiot.core.enums.RHttpStatusEnum;
import com.wyiot.pet.mapper.OrderMapper;
import com.wyiot.pet.mapper.UserMapper;
import com.wyiot.pet.model.dto.UserDTO;
import com.wyiot.pet.model.entity.OrderDO;
import com.wyiot.pet.model.entity.PetDO;
import com.wyiot.pet.model.entity.UserDO;
import com.wyiot.pet.model.vo.UserVO;
import com.wyiot.pet.service.PetService;
import com.wyiot.core.utils.R;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Random;

*/
/**
 * @author yly
 * @date 2022年03月25日
 *//*

@SpringBootTest(classes = StartApplication.class)
public class test1 {
    @Resource
    OrderMapper orderMapper;
    @Resource
    PetService petService;
    @Resource
    UserMapper userMapper;

    @Test
    public void test() {
*/
/*        AddressDO addressDO = new AddressDO();
        addressDO.setAddressUserName("test4");
        addressDO.setAddressId(15L);
        addressMapper.insert(addressDO);
        addressMapper.deleteById(11);
        addressMapper.updateById(addressDO);*//*

        OrderDO orderDO = new OrderDO();
//        orderDO.setOrderNumber(orderDO.getordernumber());
//        orderDO.setOrderPetName("皮蛋小姐3");
        orderMapper.insert(orderDO);
//        orderMapper.deleteById(1L);
    }

    @Test
    //订单号产生
    public void getOrderIdByTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate = sdf.format(new Date());
        String result = "";
        Random random = new Random();
        for (int i = 0; i < 15; i++) {
            result += random.nextInt(10);
        }
        System.out.println(newDate + result);
    }

    @Test
    void enumGetPet() {
        PetDO byId = petService.getById(2);
        System.out.println(byId.getPetName());
//        System.out.println(PetTypeEnum.getNameByCode(byId.getPetType()));
//        System.out.println(PetSizeEnum.getNameByCode(byId.getPetSize()));
*/
/*        System.out.println(PetTypeEnum.Bug.getCode());
        System.out.println(PetTypeEnum.Bug.getRemark());*//*

        System.out.println(PetTypeEnum.valueOf("Bug"));
        for (PetTypeEnum value : PetTypeEnum.values()) {
            System.out.println(value.getRemark());
        }
 */
/*       System.out.println(PetSizeEnum.getNameByCode(10));
        System.out.println(PetSizeEnum.getCodeByName("中"));*//*

    }

    @Test
    void user() {
        UserDTO userDTO = new UserDTO();
        userDTO.setUserCode("123321");
        userDTO.setUserPassword("123321");
        UserVO userDO = userMapper.selectUserByCode(userDTO.getUserCode());
        System.out.println(userDO);
        System.out.println(System.currentTimeMillis());
    }

    @Test
    void R() {
        System.out.println(R.error(RHttpStatusEnum.Error).message("123321"));
        System.out.println(R.error(123).message("123321"));
        System.out.println(R.ok(321));
    }

    @Test
    void time(){
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
        System.out.println(simpleDateFormat.format(date));
        SimpleDateFormat beginFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        System.out.println(beginFormat.format(date));
    }

    @Test
    @Transactional(rollbackFor = Exception.class)
    void order(){
//        orderMapper.changeOrderStateByOrderId(1L, OrderStatusEnum.IsFinish);

        ArrayList<Object> objects = new ArrayList<>();
        objects.add("!23");
        objects.add(2);
//        System.out.println(objects.contains("!23"));
*/
/*        orderMapper.changeOrderPayStateByOrderId(1L,false);

        System.out.println(orderMapper.whetherPayOrNotById(1L));*//*


        int size = objects.size();
        Random random = new Random();
        System.out.println(random.nextInt(size));
        System.out.println(size);
        System.out.println("----------------------------------");
        System.out.println(objects.get(random.nextInt(size)));
        System.out.println(objects.get(random.nextInt(size)));
        System.out.println(objects.get(random.nextInt(size)));
        System.out.println(objects.get(random.nextInt(size)));
        System.out.println(objects.get(random.nextInt(size)));
        System.out.println(objects.get(random.nextInt(size)));
        System.out.println(objects.get(random.nextInt(size)));
        System.out.println("----------------------------------");
        System.out.println(random.nextInt(objects.size()));
        System.out.println(random.nextInt(objects.size()));
        System.out.println(random.nextInt(objects.size()));
        System.out.println(random.nextInt(objects.size()));
        System.out.println(random.nextInt(objects.size()));
        System.out.println(random.nextInt(objects.size()));
        System.out.println("----------------------------------");
        System.out.println(objects.get(0));
    }

    @Test
    void lambdaWrapper(){
    */
/*    LambdaQueryWrapper<UserDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.between(UserDO::getUserId,1,5);
        System.out.println(userMapper.selectList(lambdaQueryWrapper));
*//*

        PetDO d = petService.getOne(Wrappers.lambdaQuery(PetDO.class)
                .eq(PetDO::getPetName, "皮蛋大哥").last("limit 1"));
        System.out.println(d);

    }
}*/
